package com.ep.interview;

public class Pump implements Runnable {
	public int all=100;
	/**同步方法 打气*/
	public  void  toPump(){
		for(int i=0;i<100;i++){
			System.out.println(all+"---------");
			all--;
		}
	}
	/**同步代码块 拔气针*/
	public void pull(){
		synchronized (this) {
			
		}
	}
	@Override
	public void run() {
		toPump();
	}
	public static void main(String[] args) {
		Pump pump=new Pump();
		Thread thread1 = new Thread(pump,"1hao");
		Thread thread2 = new Thread(pump,"2hao");
		thread1.start();
		thread2.start();
	}
}
